package com.ruoyi.web.core.config;

import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;

/**
 * 验证码操作处理
 *
 * @author Dftre
 */
@Configuration
public class SwaggerConfig {

        @Bean
        public OpenAPI springShopOpenAPI() {
                return new OpenAPI()
                                .info(new Info().title("天天创科")
                                                .description("天天创科 API文档")
                                                .version("v1")
                                                .license(new License().name("Apache 2.0").url("http://springdoc.org")))
                                .externalDocs(new ExternalDocumentation()
                                                .description("外部文档")
                                                .url("/doc.html"));
        }

        @Bean
        public GroupedOpenApi sysApi() {
                return GroupedOpenApi.builder()
                                .group("sys系统模块")
                                .packagesToScan("com.ruoyi.web.controller.system")
                                .build();
        }

        @Bean
        public GroupedOpenApi commonApi() {
                return GroupedOpenApi.builder()
                                .group("基础模块")
                                .packagesToScan("com.ruoyi.web.controller.common")
                                .build();
        }


        @Bean
        public GroupedOpenApi wvpApi() {
                return GroupedOpenApi.builder()
                                .group("wvp模块")
                                .packagesToScan("com.ruoyi.wvp.controller","com.ruoyi.wvp.api.controller")
                                .build();
        }

}
